package com.xpgk.kcys.test1;

import java.util.List;

import com.jfinal.aop.Before;
import com.jfinal.aop.Clear;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.xpgk.common.interceptors.AuthInterceptor;

public class FrontController extends Controller{

//	@Clear
	public void index(){
		renderText("Hello JFinal World!");
//		User2 user = User2.dao.findById(1);
//		System.out.println(user.get("userName"));
//		User2 user = User2.dao.findByIdLoadColumns(3, "userName");
//		new User2().set("userName", "李D四").set("age", 25).save();
//		user.set("age", 55).update();
//		List<User2> list = User2.dao.find("select * from user2 where age > ?",23);
		
//		Page<User2> list = User2.dao.paginate(1,2,"select *"," from user2 where age > ?",23);
		
//		for (int i = 0; i < list.getList().size(); i++) {
//			System.out.println(list.getList().get(i));
//		}
		
//		System.out.println(list.getList().size());
		
		List<Record> list = Db.find("select * from user2 where id = 2 ");
		for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}
	}
	
	@Before(AuthInterceptor.class)
	public void login(){
//		renderText("login!");
//		System.out.println(getPara(0));
//		System.out.println(getPara(1));
		render("login.html");
	}
}
